﻿Public Class LogOnForm 
    Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        cmbLang.SelectedIndex = 0

    End Sub

    Private Sub OK_Click(sender As System.Object, e As System.EventArgs) Handles btnOK.Click
        If txUser.Text.Equals("SERM") And txPass.Text.Equals("SERM") Then
            Me.DialogResult = Windows.Forms.DialogResult.OK
            Dim readry As MainReady = New MainReady
            Me.Hide()
            'Application.Run(New MainReady())
            readry.ShowDialog()
            Me.Close()
        Else
            MessageBox.Show("InvalidLogIn")
            txUser.Focus()
        End If

    End Sub

    Private Sub Cancel_Click(sender As System.Object, e As System.EventArgs) Handles btnCancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub LogOnForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

    End Sub

    Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
        If (keyData = Keys.Enter) Then
            If Not btnOK.Focused And Not btnCancel.Focused Then
                SendKeys.Send("{TAB}")
                Return True
            Else
                Return MyBase.ProcessCmdKey(msg, keyData)
            End If
        End If
       
        Return MyBase.ProcessCmdKey(msg, keyData)
    End Function
End Class